Class 6 Exam  >  Class 6 Questions  >  What will be the output of given program?#inc... Start Learning for Free
What will be the output of given program?
#include<stdio.h>
void main()
{
      int i=1, j=-1;
      if((printf("%d", i)) < (printf("%d", j))) 
            printf("%d", i);
      else 
            printf("%d", j);
}
  • a)
    1 -1 1
  • b)
    1 -1 -1
  • c)
    1
  • d)
    -1
Correct answer is option 'A'. Can you explain this answer?
Most Upvoted Answer
What will be the output of given program?#include<stdio.h>void m...
Here if statement is executed since we know that printf() function return the number of character print.
Here printf("%d", i) return 2 because it print 1 and newline i.e 2.
And, printf("%d', j) return 3 because it print -1 and newline i.e number of character is 3.
Therefore if statement look like if(2<3) yes its true.
So if statement will execute. And answer is 1 -1 1.
Explore Courses for Class 6 exam
Question Description
What will be the output of given program?#include<stdio.h>void main(){ int i=1, j=-1; if((printf("%d", i)) < (printf("%d", j))) printf("%d", i); else printf("%d", j);}a)1 -1 1b)1 -1 -1c)1d)-1Correct answer is option 'A'. Can you explain this answer? for Class 6 2025 is part of Class 6 preparation. The Question and answers have been prepared according to the Class 6 exam syllabus. Information about What will be the output of given program?#include<stdio.h>void main(){ int i=1, j=-1; if((printf("%d", i)) < (printf("%d", j))) printf("%d", i); else printf("%d", j);}a)1 -1 1b)1 -1 -1c)1d)-1Correct answer is option 'A'. Can you explain this answer? covers all topics & solutions for Class 6 2025 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for What will be the output of given program?#include<stdio.h>void main(){ int i=1, j=-1; if((printf("%d", i)) < (printf("%d", j))) printf("%d", i); else printf("%d", j);}a)1 -1 1b)1 -1 -1c)1d)-1Correct answer is option 'A'. Can you explain this answer?.
Solutions for What will be the output of given program?#include<stdio.h>void main(){ int i=1, j=-1; if((printf("%d", i)) < (printf("%d", j))) printf("%d", i); else printf("%d", j);}a)1 -1 1b)1 -1 -1c)1d)-1Correct answer is option 'A'. Can you explain this answer? in English & in Hindi are available as part of our courses for Class 6. Download more important topics, notes, lectures and mock test series for Class 6 Exam by signing up for free.
Here you can find the meaning of What will be the output of given program?#include<stdio.h>void main(){ int i=1, j=-1; if((printf("%d", i)) < (printf("%d", j))) printf("%d", i); else printf("%d", j);}a)1 -1 1b)1 -1 -1c)1d)-1Correct answer is option 'A'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of What will be the output of given program?#include<stdio.h>void main(){ int i=1, j=-1; if((printf("%d", i)) < (printf("%d", j))) printf("%d", i); else printf("%d", j);}a)1 -1 1b)1 -1 -1c)1d)-1Correct answer is option 'A'. Can you explain this answer?, a detailed solution for What will be the output of given program?#include<stdio.h>void main(){ int i=1, j=-1; if((printf("%d", i)) < (printf("%d", j))) printf("%d", i); else printf("%d", j);}a)1 -1 1b)1 -1 -1c)1d)-1Correct answer is option 'A'. Can you explain this answer? has been provided alongside types of What will be the output of given program?#include<stdio.h>void main(){ int i=1, j=-1; if((printf("%d", i)) < (printf("%d", j))) printf("%d", i); else printf("%d", j);}a)1 -1 1b)1 -1 -1c)1d)-1Correct answer is option 'A'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice What will be the output of given program?#include<stdio.h>void main(){ int i=1, j=-1; if((printf("%d", i)) < (printf("%d", j))) printf("%d", i); else printf("%d", j);}a)1 -1 1b)1 -1 -1c)1d)-1Correct answer is option 'A'. Can you explain this answer? tests, examples and also practice Class 6 tests.
Explore Courses for Class 6 exam
Signup to solve all Doubts
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev